/*
 * @Author: ChaiHongJun
 * @Date: 2021-07-15 16:16:29
 * @LastEditors: ChaiHongJun
 * @LastEditTime: 2021-07-15 17:31:44
 * @version:
 * @Description: 路由函数,跳转路由前,先判断登录状态,如果没登录就跳转到登录页
 */
import { getItem } from "@/utils/storage";
import router from "@/router/index.js";
/**
 * @name: 
 * @param {name} 路由组件名称
 * @param {id} 路由参数
 * @return {*}
 */
export const jump = (name, id) => {
  if (getItem("USER_TOKEN")) {
    console.log("name", name);
    console.log("id", id);
    router.push({ name, params: { id } });
  } else {
    router.push({ name: "Login", path: "/login" });
  }
}